package work.MrSun.xyq.controller;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RestController;
import work.MrSun.xyq.service.*;
import work.MrSun.xyq.util.isDelete.IsDelete;

/**
 * @Author MrSun
 * @Date 2023/4/26 19:20
 */

/**
 * 根据用户id进行删除文章以及下面所有的功能----评论等
 */
@RestController
public class DeleteMessageById {

    @Autowired
    private XyqMessageDetailService xyqMessageDetailService;

    @Autowired
    private XyqMessageImagesService xyqMessageImagesService;

    @Autowired
    private XyqAttendService xyqAttendService;

    @Autowired
    private XyqUserService xyqUserService;

    @Autowired
    private XyqCollectService xyqCollectService;

    @Autowired
    private XyqNewMessageService xyqNewMessageService;

    @Transactional
    @PostMapping("/deleteMessageById/{userId}/{messageId}")
    public IsDelete deleteByUserId(@PathVariable Integer userId, @PathVariable Integer messageId) {
        return new IsDelete().isDelete(userId, messageId, xyqMessageImagesService, xyqUserService,
                xyqMessageDetailService, xyqAttendService, xyqCollectService, xyqNewMessageService);
    }
}
